﻿using DataModel.PublicModel.Typedef;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataModel.Send
{
    /// <summary>
    /// 发送报文DATA数据部分的基本类。只增加操作类型的定义。
    /// </summary>
    public abstract class DataBase
    {
        Operator request;
        /// <summary>
        /// 操作类型
        /// </summary>
        [Newtonsoft.Json.JsonProperty(PropertyName = "request")]
        public String Request
        {
            get
            {
                return request.ToString();
            }

            set
            {
                if(!Enum.TryParse(value, out request))
                {
                    request = Operator.undefine;
                }
            }
        }
        /// <summary>
        /// 设置操作方法。由于GET/SET部分采用了STRING类型，为这里留一个原类型的
        /// </summary>
        /// <param name="value">操作类型</param>
        protected void SetRequest(Operator value)
        {
            request = value;
        }
    }
}
